﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Asteroids.Game
{
    public static class Level
    {
        // these two define the exponential growth of the number of asteroids.
        private static double ASTEROID_NUM_GROWTH = 1.2f;
        private static int ASTEROID_NUM_START = 2;

        // this defines the logarithmic growth of the number of levels that need to pass before the asteroids have one more max split level
        private static int ASTEROID_SPLIT_GROWTH = 5;
        // this defines what the Asteroid SplitLevel starts at
        private static int ASTEROID_SPLIT_START = 2;

        // these two define the exponential growth of the number of alien ships.
        private static double ALIEN_NUM_GROWTH = 1.4f;
        private static int ALIEN_NUM_START = 0;

        // this defines the number of levels that need to pass before the aliens gain an hp
        private static int ALIEN_HP_GROWTH = 15;
        // this defines what the Alien Hp starts at
        private static int ALIEN_HP_START = 2;

        // these two define the exponential growth of the speed of the alien ships
        private static double ALIEN_SPEED_GROWTH = 1.1;
        private static double ALIEN_SPEED_START = 2;

        public static int GetNumAsteroids(int level)
        {
            return level == 0 ? ASTEROID_NUM_START : (int)(Math.Pow(ASTEROID_NUM_GROWTH, level) + ASTEROID_NUM_START + level);
        }

        public static int GetNumAliens(int level)
        {
            return level == 0 ? ALIEN_NUM_START : (int)(Math.Pow(ALIEN_NUM_GROWTH, level) + ALIEN_NUM_START);
        }

        public static int GetAsteroidSplitLevel(int level)
        {
            return level < 1 ? ASTEROID_SPLIT_START : (int)(Math.Log(level, ASTEROID_SPLIT_GROWTH) + ASTEROID_SPLIT_START);
        }

        public static int GetAlienHp(int level)
        {
            return (level/ALIEN_HP_GROWTH) + ALIEN_HP_START;
        }

        public static double GetAlienSpeed(int level)
        {
            return level == 0 ? ALIEN_SPEED_START : Math.Pow(ALIEN_SPEED_GROWTH, level) + ALIEN_SPEED_START;
        }
    }
}
